﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using Bestlife.ERP.DataAccess;

/// <summary>
/// Summary description for monthLshipst
/// </summary>
/// 
namespace Bestlife.ERP.BusinessRules
{
    public class monthLshipst
    {
        #region Variables

        Boolean Check = false;
        decimal pvlevel = 0;
        decimal TCpv = 0;
        decimal Tppv = 0;
        Bestlife.ERP.BusinessRules.inserts ins = new inserts();
        Bestlife.ERP.DataAccess.D_Level_Genarator Lgen = new D_Level_Genarator();
        Bestlife.ERP.DataAccess.D_bonus bnus = new DataAccess.D_bonus();
        Bestlife.ERP.Entities.E_Bonus ebns = new Entities.E_Bonus();
        Bestlife.ERP.Entities.E_Bonus subebns = new Entities.E_Bonus();
        Bestlife.ERP.Entities.E_Level_Genarator lgen = new Entities.E_Level_Genarator();
        Bestlife.ERP.Entities.E_Level_Genarator lgensub = new Entities.E_Level_Genarator();

        Bestlife.ERP.Entities.E_AgentToCdiamand EAgnCd = new Entities.E_AgentToCdiamand();

        List<Bestlife.ERP.Entities.E_AgentToCdiamand> returnList = new List<Bestlife.ERP.Entities.E_AgentToCdiamand>();
        List<string> ReturtoProcessList = new List<string>();
        List<string> UperlevelList = new List<string>();

        #endregion

        public monthLshipst()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        #region bonus Lship Update table

        public Boolean BonusLship_Update(string id,decimal lshipPv) 
        {

        Decimal LshipATPV = lshipPv;
        Boolean Check1=false;


        Bestlife.ERP.DataAccess.parents pa = new Bestlife.ERP.DataAccess.parents();
        Bestlife.ERP.DataAccess.D_bonus dbns = new D_bonus();
        Bestlife.ERP.Entities.E_Bonus bnstable = new Entities.E_Bonus();
            //get parent
        String Parent_1 = pa.parent(id);

        bnstable = dbns.Getbonus(Parent_1);
        Decimal LshipTotTPV = bnstable.Tpv + lshipPv;
        
        try
        {

                String connStr = ConfigurationManager.ConnectionStrings["MainConnStr"].ConnectionString;
                Bestlife.ERP.DataAccess.clsCon.connect(connStr);
                String updtxt2 = "UPDATE Bonus SET  Lship_Status ='" + LshipTotTPV + "' WHERE User_id='" + Parent_1 + "'";  
                Check1 = clsCon.AddEditDel(updtxt2);
            
          
        }

        catch (Exception err)
        {

        
        }

        finally
        {
            clsCon.conn_new.Close();

        }
        return Check1;
        }

        #endregion

        #region Find childs and AddTCPVs

        public decimal returnchildTCpv(string Id,string Parentst)
        {

            int Getparentst=int.Parse(Parentst.ToString());
            int DbSt = 0;
            Decimal TpvE = 0;
            Decimal TpvR = 0;
            lgen=ins.return_Dis_Level(Id);

            if(Parentst.Equals("7"))
            {
                returnList = Lgen.GetchildBy_lvlLshipDiamand(lgen.Level, Parentst);
                returnList = Lgen.GetchildBy_lvlLshipSDiamand(lgen.Level, Parentst);
                returnList = Lgen.GetchildBy_lvlLshipSEDiamand(lgen.Level, Parentst);
                returnList = Lgen.GetchildBy_lvlLshipCDiamand(lgen.Level, Parentst);


                ReturtoProcessList=Lgen.Return_ActList(returnList);
               // returnList.Clear();

            }
            else if(Parentst.Equals("8"))
            {
                returnList = Lgen.GetchildBy_lvlLshipSDiamand(lgen.Level, Parentst);
                returnList = Lgen.GetchildBy_lvlLshipSEDiamand(lgen.Level, Parentst);
                returnList = Lgen.GetchildBy_lvlLshipCDiamand(lgen.Level, Parentst);

                ReturtoProcessList = Lgen.Return_ActList(returnList);
               // returnList.Clear();
            }
            else if(Parentst.Equals("9"))
            {
                returnList = Lgen.GetchildBy_lvlLshipSEDiamand(lgen.Level, Parentst);
                returnList = Lgen.GetchildBy_lvlLshipCDiamand(lgen.Level, Parentst);

                ReturtoProcessList = Lgen.Return_ActList(returnList);
                //returnList.Clear();
            }
            else if(Parentst.Equals("10"))
            {
                returnList = Lgen.GetchildBy_lvlLshipCDiamand(lgen.Level, Parentst);

                ReturtoProcessList = Lgen.Return_ActList(returnList);//ReturtoProcessList contain all CDiamans Except lower Cdiamands
                //returnList.Clear();
            }

            #region get ReturtoProcessList And Add All PPvs

            foreach (string childslevel in ReturtoProcessList)
            {
                #region If Get Cpv

                ebns = bnus.Getbonus(childslevel);
                DbSt = int.Parse(ebns.User_Status.ToString());
                Tppv += ebns.CPV_month;

                #endregion
            }
            ReturtoProcessList.Clear();
            returnList.Clear();
            return Tppv;

            #endregion
        }

        #endregion

        //get parent and update his lshipTPV for all level up to diamand



        public decimal returnLshipCPV(string disIDs) 
        {
            Bestlife.ERP.DataAccess.D_bonus getchild = new Bestlife.ERP.DataAccess.D_bonus();
            Bestlife.ERP.DataAccess.parents parent = new Bestlife.ERP.DataAccess.parents();  
            Bestlife.ERP.Entities.E_Bonus ebnslshp = new Bestlife.ERP.Entities.E_Bonus();//monthly Lship Process
            Bestlife.ERP.DataAccess.D_child dch = new Bestlife.ERP.DataAccess.D_child();

            Bestlife.ERP.Entities.E_Bonus ebnslshpP1 = new Bestlife.ERP.Entities.E_Bonus();//monthly Lship Process
            String Parent_1 = parent.parent(disIDs);
            ebnslshpP1 = getchild.Getbonus(Parent_1);
            decimal parentm_CPV=ebnslshpP1.CPV_month;

          

            #region To Check
            //Bestlife.ERP.Entities.E_Bonus ebnslshpP2 = new Bestlife.ERP.Entities.E_Bonus();//monthly Lship Process
            //String Parent_2 = parent.parent(Parent_1);
            //ebnslshpP2 = getchild.Getbonus(Parent_2);

            //Bestlife.ERP.Entities.E_Bonus ebnslshpP3 = new Bestlife.ERP.Entities.E_Bonus();//monthly Lship Process
            //String Parent_3 = parent.parent(Parent_2);
            //ebnslshpP3 = getchild.Getbonus(Parent_3);

            //Bestlife.ERP.Entities.E_Bonus ebnslshpP4 = new Bestlife.ERP.Entities.E_Bonus();//monthly Lship Process
            //String Parent_4 = parent.parent(Parent_3);
            //ebnslshpP4 = getchild.Getbonus(Parent_4);

            //Bestlife.ERP.Entities.E_Bonus ebnslshpP5 = new Bestlife.ERP.Entities.E_Bonus();//monthly Lship Process
            //String Parent_5 = parent.parent(Parent_4);
            //ebnslshpP5 = getchild.Getbonus(Parent_5);
            #endregion


            ebnslshp = getchild.Getbonus(disIDs);//child st
            string dis_st = ebnslshp.User_Status;
            decimal childcpv = ebnslshp.Cpv;
           

            #region Check status for l_ship

            //If senior  Diamond
            if (dis_st.Equals("7") && (ebnslshpP1.User_Status.Equals("7")))
            {
                #region Child --> parent

                decimal DiamandLshipst = 0;
                // get all childs parent1
                List<string> childlistLship = dch.childs(Parent_1);

                foreach (string childs in childlistLship) 
                {
                    if (childs != disIDs)//check first child
                    {
                        
                        DiamandLshipst += returnchildTCpv(childs, ebnslshpP1.User_Status);//go to tables

                    }
                     else 
                    {
                        parentm_CPV -= childcpv;
                    }
                }
                pvlevel = (parentm_CPV-DiamandLshipst);

                #endregion
            }

            #region To Check
            //else if (dis_st.Equals("8") && ebnslshpP1.User_Status.Equals("8") && ebnslshpP2.User_Status.Equals("8"))
            //{
            //    check = true;

            //    #region Child --> parent --> Parent

            //    #region Parent2

            //    decimal DiamandLshipst = 0;
            //    // get all childs parent1
            //    List<string> childlistLship = dch.childs(Parent_1);

            //    foreach (string childs in childlistLship)
            //    {
            //        DiamandLshipst += returnchildTTpv(childs, ebnslshpP1.User_Status);
            //    }

            //    pvlevel = DiamandLshipst;

            //    #endregion

            //    #region Parent1

            //    //ebns1 = bns.Getbonus(Parent_1);
            //    //double T_commitioninDBP1 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P1bonus = ((Productbv * 1) / 100);
            //    //Double final_P1_Lcom = T_commitioninDBP1 + P1bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP1 = p1.UpdateLcommition(Parent_1, final_P1_Lcom, Productpv, Productbv);



            //    #endregion

            //    #endregion

            //}
            #endregion

            else if (dis_st.Equals("8") && ebnslshpP1.User_Status.Equals("8") && !check)
            {
                #region Child --> parent

                #region Parent1

                decimal DiamandLshipst = 0;
                // get all childs parent1
                List<string> childlistLship = dch.childs(Parent_1);

                foreach (string childs in childlistLship)
                {
                    if (childs != disIDs)
                    {

                        DiamandLshipst += returnchildTCpv(childs, ebnslshpP1.User_Status);

                    }
                    else 
                    {
                        parentm_CPV -= childcpv;
                    }
                }
                pvlevel = (parentm_CPV - DiamandLshipst);
                #endregion

                #endregion
            }

            #region To Check
            //If senior Executive Diamond
            //else if (dis_st.Equals("9") && ebnslshpP1.User_Status.Equals("9") && ebnslshpP2.User_Status.Equals("9") && ebnslshpP3.User_Status.Equals("9"))
            //{
            //    #region Child --> parent --> Parent --> Parent

            //    #region Parent3

            //    //ebns1 = bns.Getbonus(Parent_3);
            //    //double T_commitioninDB = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P3bonuss = ((Productbv * 1) / 100);
            //    //Double final_P3_Lcom = T_commitioninDB + P3bonuss;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommition = p1.UpdateLcommition(Parent_3, final_P3_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent2

            //    //ebns1 = bns.Getbonus(Parent_2);
            //    //double T_commitioninDBP2 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P2bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P2_Lcom = T_commitioninDBP2 + P2bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP2 = p1.UpdateLcommition(Parent_2, final_P2_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent1

            //    //ebns1 = bns.Getbonus(Parent_1);
            //    //double T_commitioninDBP1 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P1bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P1_Lcom = T_commitioninDBP1 + P1bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP1 = p1.UpdateLcommition(Parent_1, final_P1_Lcom, Productpv, Productbv);

            //    #endregion

            //    #endregion

            //    //Return_userID = Parent_3;
            //}
            //else if (dis_st.Equals("9") && ebnslshpP1.User_Status.Equals("9") && ebnslshpP2.User_Status.Equals("9"))
            //{
            //    #region Child --> parent --> Parent

            //    #region Parent2

            //    //ebns1 = bns.Getbonus(Parent_2);
            //    //double T_commitioninDBP2 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P2bonus = ((Productbv * 1) / 100);
            //    //Double final_P2_Lcom = T_commitioninDBP2 + P2bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP2 = p1.UpdateLcommition(Parent_2, final_P2_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent1

            //    //ebns1 = bns.Getbonus(Parent_1);
            //    //double T_commitioninDBP1 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P1bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P1_Lcom = T_commitioninDBP1 + P1bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP1 = p1.UpdateLcommition(Parent_1, final_P1_Lcom, Productpv, Productbv);

            //    #endregion

            //    //Return_userID = Parent_2;

            //    #endregion
            //}
            #endregion

            else if (dis_st.Equals("9") && ebnslshpP1.User_Status.Equals("9"))
            {
                #region Child --> parent

                #region Parent1
                decimal DiamandLshipst = 0;
                // get all childs parent1
                List<string> childlistLship = dch.childs(Parent_1);

                foreach (string childs in childlistLship)
                {
                    if (childs != disIDs)
                    {

                        DiamandLshipst += returnchildTCpv(childs, ebnslshpP1.User_Status);

                    }
                    else
                    {
                        parentm_CPV -= childcpv;
                    }
                }
                pvlevel = (parentm_CPV - DiamandLshipst);
                #endregion

                //Return_userID = Parent_1;

                #endregion
            }

            #region To Check
            //else if (dis_st.Equals("10") && ebnslshpP1.User_Status.Equals("10") && ebnslshpP2.User_Status.Equals("10") && ebnslshpP3.User_Status.Equals("10") && ebnslshpP4.User_Status.Equals("10") && ebnslshpP5.User_Status.Equals("10"))
            //{
            //    #region Child --> parent --> Parent--> Parent--> Parent--> Parent--> Parent

            //    #region Parent5

            //    //ebns1 = bns.Getbonus(Parent_5);
            //    //double T_commitioninDB5 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P5bonuss = ((Productbv * 1) / 100);
            //    //Double final_P5_Lcom = T_commitioninDB5 + P5bonuss;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommition5 = p1.UpdateLcommition(Parent_5, final_P5_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent4

            //    //ebns1 = bns.Getbonus(Parent_4);
            //    //double T_commitioninDB4 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P4bonuss = ((Productbv * 1) / 100);
            //    //Double final_P4_Lcom = T_commitioninDB4 + P4bonuss;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommition4 = p1.UpdateLcommition(Parent_4, final_P4_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent3

            //    //ebns1 = bns.Getbonus(Parent_3);
            //    //double T_commitioninDB3 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P3bonuss = ((Productbv * 0.5) / 100);
            //    //Double final_P3_Lcom = T_commitioninDB3 + P3bonuss;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommition3 = p1.UpdateLcommition(Parent_3, final_P3_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent2

            //    //ebns1 = bns.Getbonus(Parent_2);
            //    //double T_commitioninDBP2 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P2bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P2_Lcom = T_commitioninDBP2 + P2bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP2 = p1.UpdateLcommition(Parent_2, final_P2_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent1

            //    //ebns1 = bns.Getbonus(Parent_1);
            //    //double T_commitioninDBP1 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P1bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P1_Lcom = T_commitioninDBP1 + P1bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP1 = p1.UpdateLcommition(Parent_1, final_P1_Lcom, Productpv, Productbv);

            //    #endregion

            //    #endregion

            //    //Return_userID = Parent_5;

            //}
            //else if (dis_st.Equals("10") && ebnslshpP1.User_Status.Equals("10") && ebnslshpP2.User_Status.Equals("10") && ebnslshpP3.User_Status.Equals("10") && ebnslshpP4.User_Status.Equals("10"))
            //{
            //    #region Child --> parent --> Parent--> Parent--> Parent--> Parent


            //    #region Parent4

            //    //ebns1 = bns.Getbonus(Parent_4);
            //    //double T_commitioninDB4 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P4bonuss = ((Productbv * 1) / 100);
            //    //Double final_P4_Lcom = T_commitioninDB4 + P4bonuss;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommition4 = p1.UpdateLcommition(Parent_4, final_P4_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent3

            //    //ebns1 = bns.Getbonus(Parent_3);
            //    //double T_commitioninDB3 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P3bonuss = ((Productbv * 1) / 100);
            //    //Double final_P3_Lcom = T_commitioninDB3 + P3bonuss;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommition3 = p1.UpdateLcommition(Parent_3, final_P3_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent2

            //    //ebns1 = bns.Getbonus(Parent_2);
            //    //double T_commitioninDBP2 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P2bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P2_Lcom = T_commitioninDBP2 + P2bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP2 = p1.UpdateLcommition(Parent_2, final_P2_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent1

            //    //ebns1 = bns.Getbonus(Parent_1);
            //    //double T_commitioninDBP1 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P1bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P1_Lcom = T_commitioninDBP1 + P1bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP1 = p1.UpdateLcommition(Parent_1, final_P1_Lcom, Productpv, Productbv);

            //    #endregion

            //    #endregion

            //    //Return_userID = Parent_4;

            //}
            //else if (dis_st.Equals("10") && ebnslshpP1.User_Status.Equals("10") && ebnslshpP2.User_Status.Equals("10") && ebnslshpP3.User_Status.Equals("10"))
            //{
            //    #region Child --> parent --> Parent--> Parent

            //    #region Parent3

            //    //ebns1 = bns.Getbonus(Parent_3);
            //    //double T_commitioninDB3 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P3bonuss = ((Productbv * 1) / 100);
            //    //Double final_P3_Lcom = T_commitioninDB3 + P3bonuss;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommition3 = p1.UpdateLcommition(Parent_3, final_P3_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent2

            //    //ebns1 = bns.Getbonus(Parent_2);
            //    //double T_commitioninDBP2 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P2bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P2_Lcom = T_commitioninDBP2 + P2bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP2 = p1.UpdateLcommition(Parent_2, final_P2_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent1

            //    //ebns1 = bns.Getbonus(Parent_1);
            //    //double T_commitioninDBP1 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P1bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P1_Lcom = T_commitioninDBP1 + P1bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP1 = p1.UpdateLcommition(Parent_1, final_P1_Lcom, Productpv, Productbv);

            //    #endregion

            //    //Return_userID = Parent_3;

            //    #endregion

            //}
            //else if (dis_st.Equals("10") && ebnslshpP1.User_Status.Equals("10") && ebnslshpP2.User_Status.Equals("10"))
            //{
            //    #region Child --> parent --> Parent

            //    #region Parent2

            //    //ebns1 = bns.Getbonus(Parent_2);
            //    //double T_commitioninDBP2 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P2bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P2_Lcom = T_commitioninDBP2 + P2bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP2 = p1.UpdateLcommition(Parent_2, final_P2_Lcom, Productpv, Productbv);

            //    #endregion

            //    #region Parent1

            //    //ebns1 = bns.Getbonus(Parent_1);
            //    //double T_commitioninDBP1 = double.Parse(ebns1.T_commision.ToString());
            //    //// Get commission from DB+Add product Commission
            //    //Double P1bonus = ((Productbv * 0.5) / 100);
            //    //Double final_P1_Lcom = T_commitioninDBP1 + P1bonus;
            //    //// Parent 3 Leadership Bonus
            //    //Boolean LshipCommitionP1 = p1.UpdateLcommition(Parent_1, final_P1_Lcom, Productpv, Productbv);

            //    #endregion

            //    #endregion

            //    //Return_userID = Parent_2;

            //}
            #endregion

            else if (dis_st.Equals("10") && ebnslshpP1.User_Status.Equals("10"))
            {
                #region Child --> parent

                #region Parent1

                decimal DiamandLshipst = 0;
                // get all childs parent1
                List<string> childlistLship = dch.childs(Parent_1);

                foreach (string childs in childlistLship)
                {
                    if (childs != disIDs)
                    {

                        DiamandLshipst += returnchildTCpv(childs, ebnslshpP1.User_Status);

                    }
                    else
                    {
                        parentm_CPV -= childcpv;
                    }
                }
                pvlevel = (parentm_CPV - DiamandLshipst);

                #endregion

                //Return_userID = Parent_1;

                #endregion

            }
            #endregion


            return pvlevel;
        }

        public bool check { get; set; }
    }
}